package com.demo.controllers;

import com.demo.database.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.awt.*;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 测试模板引擎控制器
 * 获取数据资源类
 * @功能
 * @创建时间 2019/11/20
 */
@Controller
public class ThymeUserController {
    @RequestMapping("/thyme.html")
    public String thymeDate(Model model){
        User user = new User(null,null,null);
        user.setUserName("张三");
        user.setGender("女");
        model.addAttribute("user",user);
        model.addAttribute("role",1);
        List<User> list = new ArrayList<User>();
        list.add(new User("张安","女",new Timestamp(System.currentTimeMillis())));
        list.add(new User("张辽","男",new Timestamp(System.currentTimeMillis())));
        list.add(new User("张勇","男",new Timestamp(System.currentTimeMillis())));
        list.add(new User("张力","女",new Timestamp(System.currentTimeMillis())));
        model.addAttribute("list",list);
        model.addAttribute("message","你吃了多少，吃饱了吗");
      return "thymeleaf";
    }
}
